package com.xiaocikuai.smallchunks.mapper.Card;

import com.xiaocikuai.smallchunks.entity.Card.WordList;
import com.xiaocikuai.smallchunks.entity.Card.Words;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 单词表 Mapper 接口
 * </p>
 *
 * @author author
 * @since 2024-09-13
 */
public interface WordsMapper extends BaseMapper<Words> {

    @Select("SELECT wid, word, chinese, speech, 0 AS correct FROM words " +
            "where cid = #{cid} AND pid = #{pid}")
    List<WordList> selectWordLists(int cid, int pid);

    @Select("SELECT wid, word, chinese, speech, 0 AS correct FROM words " +
            "where cid = #{cid} AND pid = #{pid} " +
            "ORDER BY RAND() LIMIT 2;")
    List<WordList> selectWordList(int cid, int pid);


}
